package entities;

/**
 * A CoSigner is a mutual signer for the students loan Information is used to
 * tell if student is high or low risk
 * 
 * @author gke703
 */
public class CoSigner extends Person {

	/** CoSigners have a FinancialInfo, maintaining their financial information */
	private FinancialInfo finances;

	/** reference to loan cosigned on */
	private Loan cosignedLoan;

	/**
	 * invokes constructor for Person
	 * 
	 * @param myid
	 *            int id to identify person by
	 */
	public CoSigner(int myid) {
		super(myid);
	}

	/**
	 * mutator for financial info
	 * 
	 * @param finances
	 *            the finances to set
	 */
	public void setFinancialInfo(FinancialInfo finances) {
		this.finances = finances;
	}

	/**
	 * accessor for financial info
	 * 
	 * @return the CoSigner's financial info
	 */
	public FinancialInfo getFinancialInfo() {
		return finances;
	}

	/**
	 * mutator for cosignedLoan
	 * 
	 * @param cosignedLoan
	 *            the cosignedLoan to set
	 */
	public void setCosignedLoan(Loan cosignedLoan) {
		this.cosignedLoan = cosignedLoan;
	}

	/**
	 * accessor for the cosignedLoan
	 * 
	 * @return the cosignedLoan
	 */
	public Loan getCosignedLoan() {
		return cosignedLoan;
	}

	/**
	 * regression tests
	 * 
	 * @param args
	 */
	public static void main(String[] args) {
		FinancialInfo f = new FinancialInfo();
		CoSigner myC = new CoSigner(-1);

		myC.setFinancialInfo(f);
		if (myC.getFinancialInfo() != f) {
			System.out.println("problem with setting financial info");
		}

		Loan l = new Loan(new Student(0, ""));

		myC.setCosignedLoan(l);
		if (myC.getCosignedLoan() != l) {
			System.out.println("problem setting loan");
		}

	}

}
